package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import DBLayer.*;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.border.TitledBorder;

public class ConnectGui extends JFrame {

	private JPanel contentPane;
	private Connection con;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ConnectGui frame = new ConnectGui();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ConnectGui() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panelConnect = new JPanel();
		panelConnect.setBorder(new TitledBorder(null, "Connection controle", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panelConnect.setBounds(25, 11, 292, 292);
		contentPane.add(panelConnect);
		panelConnect.setLayout(null);
		
		JButton ButtonConnect = new JButton("Connect");
		ButtonConnect.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				con = DbConnection.getInstance().getDBcon();
			}
		});
		ButtonConnect.setBounds(10, 39, 123, 38);
		panelConnect.add(ButtonConnect);
		
		JButton btnDropConnection = new JButton("Drop Connection");
		btnDropConnection.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				con.
			}
		});
		btnDropConnection.setBounds(10, 102, 123, 38);
		panelConnect.add(btnDropConnection);
		
	}
}
